local xuyi = fk.CreateSkill{
  name = "rfenghou_3d17j__xuyipeach",
  attached_skill_name = "rfenghou_3d17j__xuyipeach&"
}

xuyi:addEffect("viewas", {
  pattern = "peach",
  anim_type = "support",
  mute_card = false,
  prompt = function(self, player, selected_cards, selected)
    if not player.dying then
      return "#rfenghou_3d17j__xuyipeach-last"
    else
      return "#rfenghou_3d17j__xuyipeach"
    end
  end,
  card_filter = Util.FalseFunc,
  view_as = function (self, player, cards)
    local card = Fk:cloneCard("peach")
    card.skillName = xuyi.name
    return card
  end,
  before_use = function(self, player, use)
    if not player.dying then
      player.room:addTableMark(player, "rfenghou_3d17j__xuyipeach_banned", player.id)
      player:drawCards(player:getMaxCards() - player:getHandcardNum(), xuyi.name)
    else
      player:drawCards(1, xuyi.name)
      player:drawCards(1, xuyi.name)
    end
  end,
  enabled_at_play = function(self, player)
    return not table.contains(player:getTableMark("rfenghou_3d17j__xuyipeach_banned"), player.id) and player:isKongcheng()
  end,
  enabled_at_response = function(self, player, response)
    return not response and not table.contains(player:getTableMark("rfenghou_3d17j__xuyipeach_banned"), player.id) and player:isKongcheng()
  end
})

Fk:loadTranslationTable{
  ["rfenghou_3d17j__xuyipeach"] = "恤遗",
  [":rfenghou_3d17j__xuyipeach"] = "没有手牌的角色可以令你选择是否：与其各摸一张牌以令其视为使用【桃】；若其未处于濒死状态，其不能再发动〖恤遗〗，你改为将手牌摸至上限。",

  ["#rfenghou_3d17j__xuyipeach"] = "恤遗：摸一张牌两次并视为使用【桃】",
  ["#rfenghou_3d17j__xuyipeach-last"] = "恤遗：将手牌摸至上限并视为使用【桃】，你不能再发动〖恤遗〗",
}

return xuyi
